<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">

<link rel="shortcut icon" href="images/favicon.ico">
<link rel="icon" href="images/favicon.png">

<script>
var page_modified = 0;
var restart_time = 0;

var current_page = '<% get_parameter("current_page"); %>';
var next_page = '<% get_parameter("next_page"); %>';
var action_script = '<% get_parameter("action_script"); %>';
var group_id = '<% get_parameter("group_id"); %>';
var getflag = '<% get_parameter("flag"); %>';

<% get_flash_time(); %>

function done_validating(action){
	parent.done_validating(action, group_id);
}

function done_committing(){
	page_modified = 1;
}

function no_changes_and_no_committing(){
}

function restart_needed_time(second){
	restart_time = second;
}

function delay_redirect(next_url){
	document.redirectForm.action = next_url;
	document.redirectForm.target = "";
	document.redirectForm.submit();
}

function top_delay_redirect(next_url){
	document.redirectForm.action = next_url;
	document.redirectForm.target = "_parent";
	document.redirectForm.submit();
}

function redirect(){
	var prefix = 'http';
	if(parent.location.href.indexOf("https:") >= 0)
		prefix += 's';
	parent.location.href = prefix+'://'+parent.document.form.lan_ipaddr.value;
}

function initial(){
	if(getflag == "set_language"){
		if(navigator.appName.indexOf("Microsoft") >= 0)
			parent.parent.location.reload();
		else
			parent.parent.location.href = parent.parent.location.href;
	}
	else if(action_script.indexOf("hostname_check") >= 0){
		if(current_page.indexOf("Advanced_DDNS_Content.asp")>=0)
			setTimeout("parent.parent.checkDDNSReturnCode();", 1000);
		else
			setTimeout("parent.checkDDNSReturnCode();", 1000);
	}
	else if(action_script.indexOf("restart_ddns") >= 0) {
		setTimeout("parent.parent.checkDDNSReturnCode();", 1000);
	}
	else if(page_modified == 1){
		parent.showLoading(restart_time, "waiting");
		if(current_page.length > 0){
			if(current_page.indexOf("clients.asp") >= 0){
				document.redirectForm.flag.value = "Client";
				setTimeout("top_delay_redirect('/');", restart_time*1000);
			}
			else if(current_page == "Advanced_OperationMode_Content.asp"){
				setTimeout("hideLoading()",board_boot_time()*1000);
				setTimeout("redirect()",(board_boot_time()+2)*1000);
			}
			else if(current_page == "Advanced_LAN_Content.asp" || current_page == "Advanced_APLAN_Content.asp"){
				setTimeout("hideLoading()",5000);
				setTimeout("redirect()", 7000);
			}
			else if(getflag == "nodetect"){
				setTimeout("top_delay_redirect('"+current_page+"');", restart_time*1000);
			}
			else{
				setTimeout("parent.parent.location.href = '"+current_page+"';", restart_time*1000);
			}
		}
	}
	else{
		if(current_page.length > 0)
			setTimeout("top_delay_redirect('"+current_page+"');", restart_time*1000);
		else if(next_page.length > 0)
			setTimeout("delay_redirect('"+next_page+"');", restart_time*1000);
	}
}

function hideLoading(){
	parent.$("loadingBlock").style.visibility = "hidden";
	parent.$("Loading").style.width = "10px";
}
</script>
</head>

<body onload="initial();">
<form method="post" name="redirectForm" action="" target="">
<input type="hidden" name="flag" value="">
<input type="hidden" name="prev_page" value="">
</form>

<% update_variables(); %>
<% asus_nvram_commit(); %>
<% notify_services(); %>

</body>
</html>
